from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template


urlpatterns = patterns('oca.views',
    # Browsing
    (r'^$', 'site.main_page'),
	
	# User data management
    (r'^register/$', 'site.register_page'),
	(r'^(\w+)/profile/$', 'site.profile'),
	(r'^(\w+)/contest/$', 'site.profile'),
	
    #esto luego mover a oca app e invocar con include
    (r'contest/(\d{1,5})/$', 'contest.contest_page'),
    (r'contest/register/(\d{1,5})/$', 'contest.register_to_contest'),
    (r'contest/unregister/(\d{1,5})/$', 'contest.unregister_to_contest'),
    (r'contest/(\d{1,5})/problem/(\d{1,5})/$', 'contest.open_problem'),
	(r'contest/(\d{1,5})/problem/(\d{1,5})/compile/$', 'contest.compile_solution'),
	(r'contest/(\d{1,5})/problem/(\d{1,5})/ejecutar/$', 'contest.execute_solution'),
	(r'contest/(\d{1,5})/problem/(\d{1,5})/subir/$', 'contest.subir_codigo'),
    (r'paginator/$', 'contest.paginator'),
    (r'test/$', 'contest.test'),
)

urlpatterns += patterns('',
	(r'^register/success/$', direct_to_template,{ 'template': 'registration/register_success.html' }),
	(r'^login/$', 'django.contrib.auth.views.login'),
	(r'^login/$', 'django.contrib.auth.views.logout'),
    (r'^site_media/(?P<path>.*)$','django.views.static.serve',{'document_root': 'oca/site_media'}),
)